package day20;

import java.io.File;
import java.io.FilenameFilter;

public class FilterFileDemo {

	public static void main(String[] args) {
		demo_filter_list();
	}

	
	/**
	 * 过滤某些文件
	 */
	public static void demo_filter_list() {
		File file = new File("D:\\MyProject\\javatest\\src\\day19");
		String[] list = file.list(new FilenameFilter() {
			
			@Override
			public boolean accept(File dir, String name) {
				return name.endsWith(".class");
			}
		});
		for (String string : list) {
			System.out.println("String" + string);
		}
	}

	public static void demo_list() {
		File file = new File("D:\\MyProject\\javatest\\src\\day19");
		String[] list = file.list();
		for (String string : list) {
			System.out.println("String" + string);
		}

	}
}
